/*
 * @Author: zh
 * @Date: 2024-12-10 14:38:43
 * @LastEditors: zh
 * @LastEditTime: 2024-12-10 16:27:13
 * @Description: 这个配置文件用于 stylelint，定义了 CSS、SCSS 和 LESS 文件的规则和插件。
 */
export default {
    // 继承标准配置和属性排序配置
    extends: ['stylelint-config-standard', 'stylelint-config-property-sort-order-smacss'],
    // 添加 stylelint 插件
    plugins: ['stylelint-order', 'stylelint-prettier'],
    // customSyntax :'postcss-html'
    overrides: [
        {
            // 指定 CSS 和 HTML 文件的路径和自定义语法
            files: ['**/*.{css|html}'],
            customSyntax: 'postcss-html'
        },
        {
            // 指定 LESS 文件的路径和自定义语法
            files: ['*.less', '**/*.less'],
            customSyntax: 'postcss-less',
            extends: ['stylelint-config-standard']
        },
        {
            // 指定 SCSS 文件的路径、自定义语法和特定规则
            files: ['*.scss', '**/*.scss'],
            customSyntax: 'postcss-scss',
            extends: ['stylelint-config-standard-scss'],
            rules: {
                'scss/percent-placeholder-pattern': null
            }
        }
    ],
    rules: {
        // 确保代码风格与 Prettier 一致
        'prettier/prettier': true,
        // 禁用某些特定规则
        'media-feature-range-notation': null,
        'selector-not-notation': null,
        'import-notation': null,
        'function-no-unknown': null,
        'selector-class-pattern': null,
        // 允许特定伪类
        'selector-pseudo-class-no-unknown': [
            true,
            {
                ignorePseudoClasses: ['global', 'deep']
            }
        ],
        // 允许特定伪元素
        'selector-pseudo-element-no-unknown': [
            true,
            {
                ignorePseudoElements: ['v-deep']
            }
        ],
        // 允许特定 at 规则
        'at-rule-no-unknown': [
            true,
            {
                ignoreAtRules: ['tailwind', 'apply',
                    'variants',
                    'responsive',
                    'screen',
                    'function',
                    'if',
                    'each',
                    'include',
                    'mixin',
                    'extend',]
            }
        ],
        // 禁用某些特定规则
        'no-empty-source': null,
        'named-grid-areas-no-invalid': null,
        'no-descending-specificity': null,
        'font-family-no-missing-generic-family-keyword': null,
        // 要求在某些条件下规则前有空行
        'rule-empty-line-before': [
            'always', {
                ignore: ['first-nested', 'after-comment']
            }
        ],
        // 允许特定未知单位
        'unit-no-unknown': [
            true,
            { ignoreUnits: ['rpx'] }
        ],
        // 指定元素的顺序
        'order/order': [
            [
                'dollar-variables',
                'custom-properties',
                'at-rules',
                'declarations',
                {
                    type: 'at-rule',
                    name: 'supports'
                },
                {
                    type: 'at-rule',
                    name: 'media'
                },
                'rules'
            ],
            { severity: 'error' }
        ],
        // 指定属性的顺序
        'order/properties-order': [
            'position',
            'top',
            'right',
            'bottom',
            'left',
            'z-index',
            'display',
            'float',
            'width',
            'height',
            'max-width',
            'max-height',
            'min-width',
            'min-height',
            'padding',
            'padding-top',
            'padding-right',
            'padding-bottom',
            'padding-left',
            'margin',
            'margin-top',
            'margin-right',
            'margin-bottom',
            'margin-left',
            'margin-collapse',
            'margin-top-collapse',
            'margin-right-collapse',
            'margin-bottom-collapse',
            'margin-left-collapse',
            'overflow',
            'overflow-x',
            'overflow-y',
            'clip',
            'clear',
            'font',
            'font-family',
            'font-size',
            'font-smoothing',
            'osx-font-smoothing',
            'font-style',
            'font-weight',
            'line-height',
            'letter-spacing',
            'word-spacing',
            'color',
            'text-align',
            'text-decoration',
            'text-indent',
            'text-overflow',
            'text-rendering',
            'text-size-adjust',
            'text-shadow',
            'text-transform',
            'word-break',
            'word-wrap',
            'white-space',
            'vertical-align',
            'list-style',
            'list-style-type',
            'list-style-position',
            'list-style-image',
            'pointer-events',
            'cursor',
            'background',
            'background-color',
            'border',
            'border-radius',
            'content',
            'outline',
            'outline-offset',
            'opacity',
            'filter',
            'visibility',
            'size',
            'transform',
        ],
    },
    // 忽略以下扩展名的文件
    ignoreFiles: ['**/*.js', '**/*.jsx', '**/*.tsx', '**/*.ts'],
}